* (bug 30230) action=expandtemplates should not silently override invalid title inputs
authorSam Reed <reedy@users.mediawiki.org>
Thu, 4 Aug 2011 20:04:09 +0000 (20:04 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 4 Aug 2011 20:04:09 +0000 (20:04 +0000)
RELEASE-NOTES-1.19
includes/api/ApiExpandTemplates.php

index 70ec5a9..db0797a 100644 (file)
@@ -44,6 +44,7 @@ production.
 * (bug 29685) do not output NULL parentid with list=deletedrevs&drprop=parentid.
 * siprop=interwikimap and siprop=languages can use silanguagecode to have
   a best effort language name translation. Use CLDR extension for best result.
+* (bug 30230) action=expandtemplates should not silently override invalid title inputs
 
 === Languages updated in 1.19 ===
 
index d771ea1..fc9a451 100644 (file)
@@ -52,7 +52,7 @@ class ApiExpandTemplates extends ApiBase {
                // Create title for parser
                $title_obj = Title::newFromText( $params['title'] );
                if ( !$title_obj ) {
-                       $title_obj = Title::newFromText( 'API' ); // default
+                       $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
                }
 
                $result = $this->getResult();
@@ -109,6 +109,12 @@ class ApiExpandTemplates extends ApiBase {
                return 'Expands all templates in wikitext';
        }
 
+       public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'invalidtitle', 'title' ),
+               ) );
+       }
+
        protected function getExamples() {
                return array(
                        'api.php?action=expandtemplates&text={{Project:Sandbox}}'